/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author USER
 */
@Entity
@Table(name = "seyirci")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Seyirci.findAll", query = "SELECT s FROM Seyirci s"),
    @NamedQuery(name = "Seyirci.findByIdSeyirci", query = "SELECT s FROM Seyirci s WHERE s.idSeyirci = :idSeyirci"),
    @NamedQuery(name = "Seyirci.findByIsim", query = "SELECT s FROM Seyirci s WHERE s.isim = :isim"),
    @NamedQuery(name = "Seyirci.findByOgrenci", query = "SELECT s FROM Seyirci s WHERE s.ogrenci = :ogrenci"),
    @NamedQuery(name = "Seyirci.findByYas", query = "SELECT s FROM Seyirci s WHERE s.yas = :yas")})
public class Seyirci implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idSeyirci")
    private Integer idSeyirci;
    @Basic(optional = false)
    @Column(name = "isim")
    private String isim;
    @Column(name = "ogrenci")
    private Boolean ogrenci;
    @Column(name = "yas")
    private Integer yas;
    @OneToMany(mappedBy = "seyirciId")
    private Collection<Koltuk> koltukCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "seyirciId")
    private Collection<Bilet> biletCollection;

    public Seyirci() {
    }

    public Seyirci(Integer idSeyirci) {
        this.idSeyirci = idSeyirci;
    }

    public Seyirci(Integer idSeyirci, String isim) {
        this.idSeyirci = idSeyirci;
        this.isim = isim;
    }

    public Integer getIdSeyirci() {
        return idSeyirci;
    }

    public void setIdSeyirci(Integer idSeyirci) {
        this.idSeyirci = idSeyirci;
    }

    public String getIsim() {
        return isim;
    }

    public void setIsim(String isim) {
        this.isim = isim;
    }

    public Boolean getOgrenci() {
        return ogrenci;
    }

    public void setOgrenci(Boolean ogrenci) {
        this.ogrenci = ogrenci;
    }

    public Integer getYas() {
        return yas;
    }

    public void setYas(Integer yas) {
        this.yas = yas;
    }

    @XmlTransient
    public Collection<Koltuk> getKoltukCollection() {
        return koltukCollection;
    }

    public void setKoltukCollection(Collection<Koltuk> koltukCollection) {
        this.koltukCollection = koltukCollection;
    }

    @XmlTransient
    public Collection<Bilet> getBiletCollection() {
        return biletCollection;
    }

    public void setBiletCollection(Collection<Bilet> biletCollection) {
        this.biletCollection = biletCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idSeyirci != null ? idSeyirci.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Seyirci)) {
            return false;
        }
        Seyirci other = (Seyirci) object;
        if ((this.idSeyirci == null && other.idSeyirci != null) || (this.idSeyirci != null && !this.idSeyirci.equals(other.idSeyirci))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Seyirci[ idSeyirci=" + idSeyirci + " ]";
    }
    
}
